<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<!--插槽基本使用slot-->
<!--有默认值<slot>button</solt>-->
<!--如果有多个值，同时放入到组件替换时，一起作为替换元素-->
<div id="app">
  <cpn>
    <button>按钮一</button>
    <h2>那般</h2>
    <p>我的小乖乖</p>
  </cpn>

</div>
<template id="cpn">
  <div>
    <p>我是子组件</p>
    <button>按钮</button>
    <!--预留空间 button默认值-->
    <slot><button>按钮</button></slot>
  </div>
</template>
<script src="../js/vue.js"></script>
<script>
  const cpn = {
    template: '#cpn',
    data() {
      return {
        name: '哈哈哈'
      }
    },
    methods: {
      showMessage() {
       console.log('我是子组件')
      }
    },
    props: {}
  }
  const app = new Vue({
    el: '#app',
    data: {
      message: "你好",
    },
    components: {
      cpn
    },
    methods: {
      btnClick () {

      }
    }
  })
</script>
</body>
</html>
